/**   
 * 项目名：化工企业安全生产信息化管理平台
 * 日期：    2020-06-28 02:01:43  
 * Copyright (c) 2015- -版权所有     
 */
package com.joysuch.wwyt.audit.repository;

import com.joysuch.wwyt.audit.entity.AuditLogActionDef;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;


/**
 * AuditLogActionDefDao
 *
 */
public interface AuditLogActionDefDao extends JpaRepository<AuditLogActionDef, Long>, QuerydslPredicateExecutor<AuditLogActionDef>  {
    public Page<AuditLogActionDef> findAll(Specification<AuditLogActionDef> spec, Pageable pageable);

    public AuditLogActionDef save(AuditLogActionDef bean);

    public void delete(AuditLogActionDef bean);
    
    @Query("select count(m) from AuditLogActionDef m where code = ?1")
    long countOfCode(String code);

    @Query("select count(m) from AuditLogActionDef m where code = ?1 and id != ?2")
    long countOfCodeExcludeId(String code, Long id);
}
